#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cmath>
using namespace std;
const int N = 110, M = 1010;
double dist[N];
struct node
{
    int a, b;
    double c;
}as[M];
double x[N], y[N];
int n, m, s, t;
double calc(int a, int b)
{
    double x1 = x[b] - x[a];
    double y1 = y[b] - y[a];
    return sqrt(x1 * x1 + y1 * y1);
}
void bf()
{
    for (int i = 1; i <= n; i++)
    {
        dist[i] = 1e10;
    }
    dist[s] = 0;
    for (int i = 1; i < n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            int a = as[j].a;
            int b = as[j].b;
            double c = as[j].c;
            if (dist[a] + c < dist[b])
            {
                dist[b] = dist[a] + c;
            }
            if (dist[b] + c < dist[a])
            {
                dist[a] = dist[b] + c;
            }
        }
    }
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> x[i] >> y[i];
    }
    cin >> m;
    for (int i = 1; i <= m; i++)
    {
        int a, b;
        cin >> a >> b;
        as[i].a = a;
        as[i].b = b;
        as[i].c = calc(as[i].a, as[i].b);
    }
    cin >> s >> t;
    bf();
    printf("%.2lf", dist[t]);
    return 0;
}